package com.taptech.doufu.ui.fragment.weex;

import android.os.Bundle;

import java.util.HashMap;

/**
 * Created by Administrator on 2017/5/18/018.
 */

public class SimpleWeexFragment extends TFWXFragmentV4 {

    public static final String INTENT_WEEX_URL_KEY = "weexUrl";
    public static final String INTENT_WEEX_DATA_KEY = "weexData";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        Bundle bundle = getArguments();
        String url = "";
        Object data = null;
        if (bundle != null) {
            url = bundle.getString(INTENT_WEEX_URL_KEY);
            data = bundle.getSerializable(INTENT_WEEX_DATA_KEY);
        }
        HashMap param = new HashMap();
        param.put("url",url);
        if (data!=null){
            param.put("data",data);
        }
        super.param = param;
        super.onCreate(savedInstanceState);
    }

    public static SimpleWeexFragment newInstance(String url, HashMap data)
    {
        Bundle args = new Bundle();
        args.putString(INTENT_WEEX_URL_KEY, url);
        args.putSerializable(INTENT_WEEX_DATA_KEY, data);
        SimpleWeexFragment fragment = new SimpleWeexFragment();
        fragment.setArguments(args);
        return fragment;
    }

    public static SimpleWeexFragment newInstance(String url)
    {
        Bundle args = new Bundle();
        args.putString(INTENT_WEEX_URL_KEY, url);
        SimpleWeexFragment fragment = new SimpleWeexFragment();
        fragment.setArguments(args);
        return fragment;
    }
}
